<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>主页</title>
<style type="text/css">
td {
	text-align: center;
}

.td2 {
	text-align: right;
}

.table1 {
	border: 1px solid #ddd;
	width: 900px;
}

thead {
	background-color: lightblue;
}
</style>
</head>
<body>
	<c:if test="${empty requestScope.pagemsg}">
        没有任何用户信息！
    </c:if>
	<c:if test="${!empty requestScope.pagemsg}">
		<table border="1" cellpadding="10" cellspacing="0" class="table1">
			<thead>
				<tr>
					<th>商品名称</th>
					<th>商品价格</th>
					<th>生产日期</th>
					<th>商品描述</th>
					<th>我的操作</th>
				</tr>
			</thead>

			<c:forEach items="${requestScope.pagemsg.lists}" var="item">
				<tr>
					<td><input type="checkbox" name="ids" value="${item.id }" /></td>
					<td>${item.name }</td>
					<td>${item.price }</td>
					<td><fmt:formatDate value="${item.createtime }"
							pattern="yyyy-MM-dd HH:mm:ss" /></td>
					<td>${item.detail }</td>
					<td><a
						href="${pageContext.request.contextPath}/itemEdit/${item.id}">修改</a>
						| <a href="">删除</a></td>
				</tr>
			</c:forEach>
		</table>
	</c:if>
	<table border="0" cellspacing="0" cellpadding="0" width="900px">
		<tr>
			<td class="td2"><span>第${requestScope.pagemsg.currPage}/${requestScope.pagemsg.totalPage}页</span>&nbsp;&nbsp;
				<span>总记录数：${requestScope.pagemsg.totalCount}&nbsp;&nbsp;每页显示数${requestScope.pagemsg.pageSize}</span>&nbsp;&nbsp;
				<span> <c:if test="${requestScope.pagemsg.currPage!=1}">
						<a href="${pageContext.request.contextPath}/main?currentPage=1">[首页]</a>&nbsp;&nbsp;
    <a
							href="${pageContext.request.contextPath}/main?currentPage=${requestScope.pagemsg.currPage-1}">[上一页]</a>&nbsp;&nbsp;
    </c:if> <c:if
						test="${requestScope.pagemsg.currPage!=requestScope.pagemsg.totalPage}">
						<a
							href="${pageContext.request.contextPath}/main?currentPage=${requestScope.pagemsg.currPage+1}">[下一页]</a>&nbsp;&nbsp;
        <a
							href="${pageContext.request.contextPath}/main?currentPage=${requestScope.pagemsg.totalPage}">[尾页]</a>&nbsp;&nbsp;
    </c:if>
			</span></td>
		</tr>
	</table>
</body>
</html>